import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2022-9-02
 * Time: 下午 18:32
 */
public class Demo1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int[] array= {2,3,2,4};
        while(in.hasNext()) {
            int n = in.nextInt();
            if(n <= 2) {
                System.out.println(-1);
                break;
            }

            System.out.println(array[(n+1)%4]);
        }
    }
}
